import request from '@/utils/request'

export default {
  // 获取爬虫基本信息和错误数据的list
  crawlerDetail(page, limit, searchObj) {
    return request.service({
      url: `/crawler/web/crawlerDetail/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 获取错误类型list
  crawlerDetailTypes(formData) {
    return request.service({
      url: `/crawler/web/crawlerDetail/types`,
      method: 'post',
      data: formData
    })
  },

  // 根据爬虫数据id获取爬虫数据信息
  crawlerDataById(searchObj) {
    return request.service({
      url: `/crawler/web/crawlerDataById`,
      method: 'post',
      data: searchObj
    })
  },

  // 提交修改后的爬虫数据信息
  updateCommit(updateObj) {
    return request.service({
      url: `/crawler/web/updateCommit`,
      method: 'post',
      data: updateObj
    })
  },

  // 修改爬虫数据的处理状态
  updateStatus(status, did) {
    return request.service({
      url: `/crawler/web/updateStatus`,
      method: 'get',
      params: {
        status,
        did
      }
    })
  },

  updateInfo(infoData) {
    return request.service({
      url: `/crawler/web/updateInfo`,
      method: 'post',
      data: infoData
    })
  },

  // 上传附件
  uploadFile(formData) {
    return request.service({
      url: `/crawler/web/uploadFiles`,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data: formData
    })
  },

  multipleHandle(formData) {
    return request.service({
      url: `/crawler/web/multipleHandle`,
      method: 'post',
      data: formData
    })
  },

  addData(formData) {
    return request.service({
      url: `/crawler/web/addData`,
      method: 'post',
      data: formData
    })
  },

  addDataPolicy(formData) {
    return request.service({
      url: `/crawler/web/addDataPolicy`,
      method: 'post',
      data: formData
    })
  },

  oneTouchIgnore(id, type) {
    return request.service({
      url: `/crawler/web/oneTouchIgnore`,
      method: 'get',
      params: {
        id, type
      }
    })
  },

  listPageCrawlerData(formData) {
    return request.service({
      url: `/crawler/web/listPageCrawlerData`,
      method: 'post',
      data: formData
    })
  }

}
